# create a new sundries server
#
# These servers run a number of smaller apps that don't merit their own instances.
#

- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=sundries:sundries_stg"

- name: make the box be real
  hosts: sundries:sundries_stg
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - base
  - rkhunter
  - nagios_client
  - hosts
  - { role: openvpn/client,
      when: env != "staging" }
  - ipa/client
  - collectd/base
  - mod_wsgi
  - geoip
  - { role: geoip-city-wsgi/app,  when: ansible_distribution_major_version|int <= 7 and ansible_distribution == 'RedHat' }
  - role: easyfix/gather
    when: master_sundries_node|bool
  - role: bz_review_report
    when: master_sundries_node|bool and env != "staging"
  - rsyncd
  - freemedia
  - sudo
  - pager_server
  - role: zanata
    when: master_sundries_node|bool
  - role: fedora-web/build
    when: master_sundries_node|bool
  - role: fedora-web/translation
    when: master_sundries_node|bool
  - role: fedora-budget/build
    when: master_sundries_node|bool
  - role: fedora-docs/build
    when: master_sundries_node|bool
  - role: fedora-docs/translation
    when: master_sundries_node|bool
  - role: membership-map/build
    when: master_sundries_node|bool
  - role: developer/build
    when: master_sundries_node|bool
  - role: fedoraloveskde/build
    when: master_sundries_node|bool
  - role: fedora-web/kinoite/build
    when: master_sundries_node|bool
  - role: rabbit/user
    username: "sundries{{ env_suffix }}"
    sent_topics: ^$
    when: master_sundries_node|bool and deployment_type == "stg"
  - role: fedmsg/base
    when: master_sundries_node|bool
  - role: nfs/client
    mnt_dir: '/srv/docs'
    nfs_src_dir: 'openshift_{{ env_short }}_docs'
    mount_stg: true
  - role: nfs/client
    mnt_dir: '/srv/websites'
    nfs_src_dir: 'openshift_{{ env_short }}_websites'
    mount_stg: true
  - role: nfs/client
    mnt_dir: '/srv/web/review-stats'
    nfs_src_dir: 'openshift_{{ env_short }}_reviewstats'
    mount_stg: true
  - role: nfs/client
    mnt_dir: '/srv/web/registry-index'
    nfs_src_dir: 'flatpak-indexer-storage-stg'
    mount_stg: true
    when: master_sundries_node|bool and env == "staging"
  - role: nfs/client
    mnt_dir: '/srv/web/registry-index'
    nfs_src_dir: 'flatpak-indexer-storage'
    mount_stg: true
    when: master_sundries_node|bool and env != "staging"

  pre_tasks:
  - import_tasks: "{{ tasks_path }}/yumrepos.yml"

  tasks:
  - import_tasks: "{{ tasks_path }}/motd.yml"
  - import_tasks: "{{ tasks_path }}/reg-server.yml"

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
